package com.jie.test;

import com.alibaba.fastjson.JSON;
import com.jie.entity.Agency;
import com.jie.service.AgencyService;
import com.jie.service.impl.AgencyServiceImpl;
import com.jie.util.ExportExcelUtil;

import java.io.IOException;
import java.util.List;

/**
 * Created by 12904 on 2018/7/30.
 */
public class test
{



    public static void main(String[] args) throws IOException
    {

        AgencyService service = new AgencyServiceImpl();
        List<Agency> list = service.find(0,5);


        for (Agency sInfo: list) {
            System.out.print(sInfo.getUid()+"\n");
            System.out.print(sInfo.getUlist().get(0).getUname()+"\n");
            System.out.print(sInfo.getUlist().get(0).getUphone()+"\n");
            System.out.print(sInfo.getRlist().get(0).getAreaName()+"\n");
            System.out.print(sInfo.getRlist().get(1).getAreaName()+"\n");
            System.out.print(sInfo.getRlist().get(2).getAreaName()+"\n");
            System.out.print(sInfo.getUlist().get(0).getUaddress()+"\n");
            System.out.print(sInfo.getUlist().get(0).getUsex()+"\n");
            System.out.print(sInfo.getUlist().get(0).getCreateTime()+"\n");
            System.out.print(sInfo.getUlist().get(0).getOpenid()+"\n");
            System.out.print(sInfo.getUlist().get(0).getUemail()+"\n");
        }

//        String data = JSON.toJSONString(list);
//        String url="E:/test.xls";
//
//        ExportExcelUtil.exportExcel(data,url);




    }

//    /**
//     * 导出
//     */
//    private void export() {
//        MyFileFilterExcel excelFilter = new MyFileFilterExcel();
//        MyFileFilterXML xmlFilter = new MyFileFilterXML();
//        List<FileFilter> filters = new ArrayList<FileFilter>();
//        filters.add(excelFilter);
//        filters.add(xmlFilter);
//        boolean createFileRs = false;
//        String[] pathAndTypeStr = ExportFileService.exportFile(filters);
//        if(pathAndTypeStr==null){
//            return ;
//        }
//        List<List<Object>> data = changeDataToFile();
//        if (pathAndTypeStr[1].equals(excelFilter.getDescription())) {
//            pathAndTypeStr[0] = pathAndTypeStr[0] + ".xls";
//            createFileRs = ExportFileService.createExcel(pathAndTypeStr[0], data,
//                    viewAccountV.comboxYearAndMonth.getSelectedItem().toString());
//        } else if (pathAndTypeStr[1].equals(xmlFilter.getDescription())) {
//            pathAndTypeStr[0] = pathAndTypeStr[0] + ".xml";
//            createFileRs = ExportFileService.createXML(pathAndTypeStr[0], data);
//        }
//        JOptionPane.showMessageDialog(null, "文件导出"
//                        + (createFileRs ? "成功" : "失败"), "提示",
//                JOptionPane.INFORMATION_MESSAGE);
//    }




}
